package org.boge.sharpdoc.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.boge.sharpdoc.dao.SendMsgDao;
import org.boge.sharpdoc.bean.SendMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class SendMsgService {
    @Autowired
    private SendMsgDao sendMsgDao;

    public PageInfo<SendMsg> getOnesMsg(Integer index, Integer pageSize, Long phone) {
        return PageHelper.startPage(index, pageSize).doSelectPageInfo(() -> sendMsgDao.findAllMsgOfCustomer(phone));
    }

    public Integer addMsg(SendMsg sendMsg) {
        return sendMsgDao.addMsg(sendMsg);
    }
}